let fs=require('fs');
fs.open('test.txt','a',function(err,fd){
    if(err){
        return console.error(err);
    }
    console.log('open');
    let buf=Buffer.from(new String('hello world'));
    fs.write(fd,buf,0,10,0,function(err,bytes,buffer){
		if(err){
			throw err;
		}
		console.log('written');
		console.log(bytes+' written');
		console.log(buffer.slice(0,bytes).toString());
	});
	fs.close(fd,function(err){
		if(err){
			console.lor(err);
		}
		console.log('closed');
	});
});
